/* 手机端专用样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* 隐藏滚动条 */
html, body {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

/* 针对所有可滚动元素隐藏滚动条 */
*::-webkit-scrollbar {
    width: 0;
    height: 0;
    background: transparent;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
    padding-bottom: 180px; /* 为底部导航和交易面板留出足够空间 */
}

/* 顶部状态栏 */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

/* 左侧用户信息 */
.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.username {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.balance-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.balance-amount {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.frozen {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 8px;
    display: inline-block;
    backdrop-filter: blur(5px);
}

.guest-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.guest-tip {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
    backdrop-filter: blur(5px);
}

/* 中间WebSocket状态指示器 */
.websocket-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    font-size: 12px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    margin: 0 12px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    position: relative;
}

.status-indicator.connected {
    background: #4caf50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}

.status-indicator.connecting {
    background: #ff9800;
    animation: pulse 1s infinite;
}

.status-indicator.disconnected {
    background: #f44336;
    animation: pulse 0.5s infinite;
}

.status-indicator.error {
    background: #f44336;
    animation: pulse 0.3s infinite;
}

.status-indicator.failed {
    background: #9c27b0;
}

.status-text {
    font-weight: 500;
    white-space: nowrap;
}

/* 右侧区域 */
.right-section {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.user-avatar:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.5);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.login-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.login-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 脉冲动画 */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 480px) {
    .top-bar {
        padding: 10px 12px;
    }
    
    .username {
        font-size: 15px;
    }
    
    .balance-amount {
        font-size: 13px;
    }
    
    .frozen {
        font-size: 10px;
        padding: 1px 5px;
    }
    
    .websocket-status {
        padding: 5px 10px;
        margin: 0 8px;
        font-size: 11px;
    }
    
    .status-indicator {
        width: 7px;
        height: 7px;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
    }
    
    .login-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .top-bar {
        padding: 8px 10px;
    }
    
    .websocket-status {
        margin: 0 6px;
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .status-text {
        display: none;
    }
    
    .frozen {
        display: none;
    }
}

/* 价格显示区域 */
.price-section {
    background: white;
    margin: 15px 20px;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    text-align: center;
    position: relative; /* 为连接状态指示器提供定位参考 */
}

.current-price-display {
    margin-bottom: 20px;
}

.price-label {
    display: block;
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.price-value {
    font-size: 38px;
    font-weight: bold;
    color: #4caf50;
    display: block;
    transition: all 0.3s ease;
}

.round-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 15px;
}

.round-number {
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

.countdown-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

#round-status {
    font-size: 12px;
    color: #666;
}

#countdown {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #2196f3;
    font-size: 18px;
}

/* 图表区域 */
.chart-section {
    background: white;
    margin: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* 图表切换标签 */
.chart-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.chart-tab {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chart-tab.active {
    color: #007bff;
    background: white;
    border-bottom: 3px solid #007bff;
}

.chart-tab:hover {
    background: #e9ecef;
}

.chart-tab.active:hover {
    background: white;
}

/* 图表容器 */
.chart-container {
    padding: 20px;
    transition: all 0.3s ease;
}

#priceChart, #klineChart {
    width: 100% !important;
    height: 250px !important;
}

/* K线图控制区域 */
.kline-controls {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* 日期筛选器 */
.date-filter-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.date-filter-inline label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
}

.date-filter-inline select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #333;
    min-width: 120px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-filter-inline select:focus {
    outline: none;
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.date-filter-inline select:hover {
    border-color: #4caf50;
}

/* 每日K线图区域 */
#daily-kline-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-top: 15px;
}

/* 原生Canvas K线图 */
#nativeKlineCanvas {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e9ecef;
    border-radius: 8px;
    margin-top: 15px;
    cursor: grab;
    touch-action: manipulation;
    width: 100%;
    max-width: 100%;
    height: 350px;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

#nativeKlineCanvas:hover {
    border-color: #4caf50;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.15);
}

#nativeKlineCanvas:active {
    cursor: grabbing;
    transform: scale(0.98);
}

/* 每日K线图汇总信息 */
.daily-kline-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    color: white;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.daily-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.summary-item {
    text-align: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.summary-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.summary-item .label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-item .value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .kline-controls {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .date-filter-inline {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .date-filter-inline select {
        width: 100%;
        min-width: auto;
    }
    
    #daily-kline-section {
        padding: 15px;
        margin-top: 12px;
    }
    
    #nativeKlineCanvas {
        height: 300px;
        margin-top: 12px;
    }
    
    .daily-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .summary-item {
        padding: 10px;
    }
    
    .summary-item .label {
        font-size: 11px;
    }
    
    .summary-item .value {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .daily-summary {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    #nativeKlineCanvas {
        height: 250px;
    }
    
    .kline-controls {
        padding: 10px;
    }
    
    #daily-kline-section {
        padding: 12px;
    }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    #nativeKlineCanvas {
        cursor: default;
    }
    
    .summary-item:hover {
        transform: none;
        background: rgba(255, 255, 255, 0.1);
    }
    
    .date-filter-inline select:hover {
        border-color: #ddd;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .kline-controls {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .date-filter-inline select {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .date-filter-inline select:focus {
        border-color: #68d391;
        box-shadow: 0 0 0 3px rgba(104, 211, 145, 0.1);
    }
    
    #daily-kline-section {
        background: #2d3748;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
    
    #nativeKlineCanvas {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        border-color: #718096;
    }
}

/* 交易面板 - 悬浮在底部 */
.trading-panel {
    background: white;
    position: fixed;
    bottom: 55px; /* 紧贴底部导航栏 */
    left: 0;
    right: 0;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 100; /* 确保在其他元素之上 */
    transition: transform 0.3s ease;
}

.panel-header {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    padding: 12px;
    text-align: center;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: bold;
}

.trade-form {
    padding: 26px 15px;
}

.amount-section {
    margin-bottom: 8px;
}

.amount-section label {
    display: flex;
        margin-bottom: 4px;
        font-weight: bold;
        color: #333;
        font-size: 13px;
        justify-content: space-between;
        align-items: center;
}

.input-group {
    display: flex;
    gap: 8px;
}

#amount {
    flex: 1;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.3s;
}

#amount:focus {
    outline: none;
    border-color: #4caf50;
}

.buy-btn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    min-width: 70px;
}

.buy-btn:active {
    transform: scale(0.95);
}

.buy-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 快捷金额按钮 */
.quick-amounts {
    width: 250px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 0;
}

.amount-btn {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    padding: 6px 0;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.amount-btn:active {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
    transform: scale(0.95);
}

/* 市场交易记录区域 */
.market-trades-section {
    background: white;
    margin: 15px 20px;
    margin-bottom: 90px; /* 为交易面板留出空间 */
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.market-trades-container {
    max-height: 150px; /* 减小高度 */
    overflow-y: auto;
    padding: 0 10px;
}

.market-trade-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 5px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.market-trade-item:last-child {
    border-bottom: none;
}

.trade-user {
    color: #666;
    font-size: 12px;
}

.trade-buy {
    color: #4caf50;
}

.trade-sell {
    color: #f44336;
}

.trade-time {
    color: #999;
    font-size: 11px;
    margin-left: 5px;
}

/* 新交易记录动画效果 */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes highlightNew {
    0% {
        background-color: #fff3cd;
    }
    50% {
        background-color: #fff8dc;
    }
    100% {
        background-color: white;
    }
}

.market-trade-item.new-trade {
    animation: slideInFromRight 0.5s ease-out, highlightNew 2s ease-in-out;
}

.trade-time.updating {
    color: #007bff;
    font-weight: bold;
    transition: color 0.3s ease;
}

.trade-amount {
    font-weight: bold;
}

.refresh-btn {
    background: transparent;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.refresh-btn:active {
    background: rgba(0,0,0,0.1);
}

.refresh-icon {
    font-size: 16px;
}

.round-info-text {
    text-align: center;
    padding: 8px 0;
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    margin-bottom: 5px;
}

/* 持仓区域 */
.positions-section {
    background: white;
    margin: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.section-header {
    background: #f8f9fa;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.section-header h3 {
    font-size: 18px;
    color: #333;
}

.positions-count {
    background: #2196f3;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
}

.positions-container {
    max-height: 400px;
    overflow-y: auto;
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #666;
}

.empty-state .tip {
    font-size: 14px;
    margin-top: 10px;
}

/* 持仓卡片 */
.position-card {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.position-card:last-child {
    border-bottom: none;
}

.position-card:active {
    background: #f8f9fa;
}

.position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.round-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
}

.sell-btn {
    background: #ff5722;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.sell-btn:active {
    transform: scale(0.95);
}

.position-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.detail-item {
    text-align: center;
}

.detail-item .label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.detail-item .value {
    display: block;
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

.profit-positive {
    color: #4caf50 !important;
}

.profit-negative {
    color: #f44336 !important;
}

/* 盈亏更新动画 */
.profit-updated {
    animation: profitUpdate 1s ease-in-out;
}

@keyframes profitUpdate {
    0% {
        transform: scale(1);
        background-color: transparent;
    }
    50% {
        transform: scale(1.1);
        background-color: rgba(76, 175, 80, 0.2);
    }
    100% {
        transform: scale(1);
        background-color: transparent;
    }
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-top: 1px solid #e8e9ea;
    display: flex;
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0 0 env(safe-area-inset-bottom);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px;
    text-decoration: none;
    color: #6c757d;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border-radius: 12px 12px 0 0;
    margin: 0 2px;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
    border-radius: 0 0 3px 3px;
}

.nav-item.active::before {
    width: 24px;
}

.nav-item.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.08);
    transform: translateY(-2px);
}

.nav-item:active {
    transform: scale(0.95);
    background: rgba(102, 126, 234, 0.12);
}

.nav-icon {
    font-size: 20px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.nav-item.active .nav-icon {
    background: rgba(102, 126, 234, 0.15);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.nav-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item.active .nav-icon svg {
    transform: scale(1.1);
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.3));
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.2px;
}

.nav-item.active .nav-label {
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(102, 126, 234, 0.2);
}

/* 导航动画效果 */
@keyframes navItemPulse {
    0% { transform: translateY(-2px) scale(1); }
    50% { transform: translateY(-2px) scale(1.05); }
    100% { transform: translateY(-2px) scale(1); }
}

.nav-item.active.nav-pulse {
    animation: navItemPulse 0.4s ease-out;
}

/* 响应式优化 */
@media (max-width: 480px) {
    .nav-item {
        padding: 8px 6px;
        margin: 0 1px;
    }
    
    .nav-icon {
        width: 28px;
        height: 28px;
        margin-bottom: 4px;
    }
    
    .nav-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .nav-label {
        font-size: 10px;
    }
    
    .nav-item::before {
        height: 2px;
    }
    
    .nav-item.active::before {
        width: 20px;
    }
}

/* 加载和通知 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    color: white;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.notification {
    position: fixed;
    top: 80px;
    left: 20px;
    right: 20px;
    background: #4caf50;
    color: white;
    padding: 15px 20px;
    border-radius: 15px;
    text-align: center;
    font-weight: bold;
    z-index: 150;
    transform: translateY(-100px);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateY(0);
}

.notification.error {
    background: #f44336;
}

/* 动画效果 */
.price-value.updated {
    animation: priceFlash 0.6s ease-in-out;
}

@keyframes priceFlash {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); background: #e8f5e8; border-radius: 10px; }
    100% { transform: scale(1); }
}

/* 滚动优化 */
.positions-container {
    -webkit-overflow-scrolling: touch;
}

/* iOS Safari 适配 */
@supports (-webkit-touch-callout: none) {
    .top-bar {
        padding-top: max(15px, env(safe-area-inset-top));
    }
    
    .bottom-nav {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    body {
        padding-bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));
    }
}

/* 账户页面样式 */
.account-section {
    padding: 20px 20px 100px 20px;
}

.account-header {
    text-align: center;
    margin-bottom: 25px;
}

.account-header h3 {
    color: white;
    font-size: 24px;
    font-weight: bold;
}

.account-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 余额卡片 */
.balance-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    position: relative;
}

.balance-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4caf50 0%, #2196f3 50%, #ff9800 100%);
}

.balance-details {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(255,255,255,0.8);
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.balance-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #e0e0e0;
    transition: all 0.3s ease;
}

.balance-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    background: rgba(255,255,255,0.95);
}

.balance-item.total {
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%);
    border: 1px solid rgba(33, 150, 243, 0.2);
    margin-top: 8px;
    position: relative;
}

.balance-item.total::before {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
}

.balance-item.total:hover {
    transform: none;
    box-shadow: none;
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%);
    border-color: rgba(33, 150, 243, 0.2);
}

.balance-item .label {
    font-size: 13px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.balance-item .value {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
}

.main-balance {
    color: #4caf50 !important;
    font-size: 18px !important;
}

.frozen-balance {
    color: #ff9800 !important;
}

.total-balance {
    color: #2196f3 !important;
    font-size: 20px !important;
    font-weight: 800 !important;
}

/* 统计卡片 */
.stats-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 25px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 12px;
    color: #666;
    font-weight: bold;
}

/* 资金操作 */
.money-actions {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    overflow: hidden;
}

.money-buttons {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.money-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    font-size: 14px;
}

.deposit-btn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
}

.deposit-btn:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #45a049 0%, #388e3c 100%);
}

.withdraw-btn {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
}

.withdraw-btn:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
}

.money-btn .btn-icon {
    font-size: 18px;
    margin-right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.money-btn .btn-icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: brightness(1) contrast(1);
    transition: all 0.3s ease;
}

.money-btn:hover .btn-icon img,
.money-btn:active .btn-icon img {
    filter: brightness(1.1) contrast(1.1);
    transform: scale(1.05);
}

.money-btn .btn-text {
    font-size: 16px;
}

/* 账户操作 */
.account-actions {
    background: transparent;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 20px;
}

.action-buttons {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 5px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;

}

.action-btn:active {
    transform: scale(0.95);
    background: rgba(0,0,0,0.05);
}

.action-btn.logout-action {
    color: #d32f2f;
}

.action-btn.logout-action:active {
    background: rgba(211, 47, 47, 0.1);
}

.btn-icon {
    font-size: 20px;
    margin-bottom: 8px;
    width: 30px;
    height: 30px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(1) contrast(1);
    transition: all 0.3s ease;
}

.action-btn:hover .btn-icon img,
.action-btn:active .btn-icon img {
    filter: brightness(1.1) contrast(1.1);
    transform: scale(1.05);
}

.btn-text {
    font-size: 12px;
    font-weight: normal;
}

/* 盈利解冻提醒 */
.frozen-notice {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 1px solid #ffb74d;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notice-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.notice-content {
    flex: 1;
}

.notice-title {
    font-size: 13px;
    font-weight: bold;
    color: #e65100;
    margin-bottom: 3px;
    line-height: 1.2;
}

.notice-text {
    font-size: 12px;
    color: #bf360c;
    line-height: 1.3;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:active {
    background: rgba(255,255,255,0.2);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.loading-text {
    text-align: center;
    color: #666;
    padding: 40px;
}

/* 交易记录列表 */
.transaction-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-info {
    flex: 1;
}

.transaction-type {
    font-weight: bold;
    margin-bottom: 5px;
}

.transaction-type.buy {
    color: #4caf50;
}

.transaction-type.sell {
    color: #f44336;
}

.transaction-details {
    font-size: 12px;
    color: #666;
}

.transaction-amount {
    text-align: right;
    font-weight: bold;
}

.transaction-profit {
    font-size: 12px;
    margin-top: 3px;
}

.profit-positive {
    color: #4caf50;
}

.profit-negative {
    color: #f44336;
}

/* 页面切换动画 */
.page-section {
    transition: all 0.3s ease;
}

.page-section.hidden {
    opacity: 0;
    transform: translateX(-20px);
    pointer-events: none;
}

/* 充值提现弹窗样式 */
.deposit-header {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%) !important;
}

.withdraw-header {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%) !important;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4caf50;
}

.available-balance {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #e3f2fd;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 2px solid #2196f3;
}

.available-balance .label {
    font-weight: bold;
    color: #1976d2;
}

.available-balance .value {
    font-size: 18px;
    font-weight: bold;
    color: #1976d2;
}

.quick-amounts-deposit,
.quick-amounts-withdraw {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.quick-amount-btn {
    padding: 12px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-amount-btn:active {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
    transform: scale(0.95);
}

.deposit-notice,
.withdraw-notice {
    background: #fff3e0;
    border: 2px solid #ffb74d;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.deposit-notice p,
.withdraw-notice p {
    margin-bottom: 10px;
    font-weight: bold;
    color: #e65100;
}

.deposit-notice ul,
.withdraw-notice ul {
    margin: 0;
    padding-left: 20px;
    color: #bf360c;
}

.deposit-notice li,
.withdraw-notice li {
    margin-bottom: 5px;
    font-size: 14px;
}

.submit-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
}

.deposit-submit {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
}

.withdraw-submit {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
}

.submit-btn:active {
    transform: scale(0.98);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 提现记录表格样式 */
.withdraw-records {
    width: 100%;
    overflow-x: auto;
}

.withdraw-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 14px;
}

.withdraw-table th,
.withdraw-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.withdraw-table th {
    background: #f8f9fa;
    font-weight: bold;
    color: #333;
}

.withdraw-table tr:last-child td {
    border-bottom: none;
}

.status-completed {
    color: #4caf50;
    font-weight: bold;
}

.status-pending {
    color: #ff9800;
    font-weight: bold;
}

.status-failed {
    color: #f44336;
    font-weight: bold;
}

/* 横屏适配 */
@media (orientation: landscape) and (max-height: 500px) {
    .price-section {
        margin: 10px 20px;
        padding: 20px;
    }
    
    .price-value {
        font-size: 36px;
    }
    
    #priceChart {
        height: 200px !important;
    }
    
    .trading-panel .panel-header {
        padding: 15px;
    }
    
    .trade-form {
        padding: 20px;
    }
    
    .account-section {
        padding: 15px 20px 100px 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
        padding: 20px;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 20px;
    }
}

/* 游客用户样式 */
.guest-info {
    display: flex;
    align-items: center;
}

.guest-tip {
    background: #fff3cd;
    color: #856404;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.login-btn {
    background: #4caf50;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
}

.login-btn:hover {
    background: #45a049;
}

/* 游客交易面板 */
.guest-trading-panel {
    padding: 30px 20px;
    text-align: center;
    background: white;
    border-radius: 20px;
    margin: 15px 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.guest-message h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 20px;
}

.guest-message p {
    color: #666;
    margin-bottom: 25px;
    font-size: 14px;
}

.guest-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.login-action-btn, .register-action-btn {
    padding: 12px 25px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    transition: transform 0.2s;
}

.login-action-btn {
    background: #2196f3;
    color: white;
}

.register-action-btn {
    background: #4caf50;
    color: white;
}

.login-action-btn:hover, .register-action-btn:hover {
    transform: translateY(-2px);
}

.or-divider {
    color: #999;
    font-size: 12px;
}

/* 游客账户区域 */
.guest-account-section {
    padding: 20px;
}

.guest-welcome {
    text-align: center;
    margin-bottom: 30px;
}

.guest-welcome h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 22px;
}

.guest-welcome p {
    color: #666;
    font-size: 14px;
}

.guest-account-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.account-action-btn {
    flex: 1;
    padding: 15px;
    border-radius: 12px;
    text-decoration: none;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    transition: transform 0.2s;
}

.account-action-btn.primary {
    background: #2196f3;
    color: white;
}

.account-action-btn.secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e9ecef;
}

.account-action-btn:hover {
    transform: translateY(-2px);
}

.guest-features {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.guest-features h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 16px;
}

.guest-features ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.guest-features li {
    padding: 8px 0;
    color: #666;
    font-size: 14px;
    position: relative;
    padding-left: 20px;
}

.guest-features li:before {
    content: "✓";
    color: #4caf50;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* 修改密码弹窗样式 */
.change-password-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.password-notice {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.password-notice p {
    margin: 0 0 10px 0;
    font-weight: bold;
    color: #856404;
}

.password-notice ul {
    margin: 0;
    padding-left: 20px;
}

.password-notice li {
    color: #666;
    font-size: 13px;
    margin-bottom: 5px;
}

.change-password-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 15px;
    border-radius: 12px;
    width: 100%;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.change-password-submit:hover {
    transform: translateY(-2px);
}

.change-password-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 密码输入框样式增强 */
#change-password-form input[type="password"] {
    position: relative;
}

#change-password-form input[type="password"]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* 密码强度提示样式 */
.password-strength-hint,
.password-match-hint {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
}

.password-strength-hint small,
.password-match-hint small {
    display: block;
    margin: 2px 0;
}

/* 密码强度指示器 */
.password-strength-indicator {
    margin-top: 8px;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.password-strength-weak {
    background: #dc3545;
    width: 25%;
}

.password-strength-medium {
    background: #ffc107;
    width: 50%;
}

.password-strength-strong {
    background: #198754;
    width: 75%;
}

.password-strength-very-strong {
    background: #20c997;
    width: 100%;
}

/* WebSocket连接状态指示器 */
.websocket-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(15px);
    font-size: 13px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1000;
}

.websocket-status:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #999;
    position: relative;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

.status-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid transparent;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.status-indicator.connected {
    background: #4caf50;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.6);
    animation: pulse-green 2s infinite;
}

.status-indicator.connected::before {
    border-color: rgba(76, 175, 80, 0.3);
    animation: ripple-green 2s infinite;
}

.status-indicator.connecting {
    background: #ff9800;
    box-shadow: 0 0 12px rgba(255, 152, 0, 0.6);
    animation: pulse-orange 1s infinite;
}

.status-indicator.connecting::before {
    border-color: rgba(255, 152, 0, 0.3);
    animation: ripple-orange 1s infinite;
}

.status-indicator.disconnected {
    background: #f44336;
    box-shadow: 0 0 12px rgba(244, 67, 54, 0.6);
    animation: pulse-red 0.8s infinite;
}

.status-indicator.disconnected::before {
    border-color: rgba(244, 67, 54, 0.3);
    animation: ripple-red 0.8s infinite;
}

.status-indicator.error {
    background: #f44336;
    box-shadow: 0 0 12px rgba(244, 67, 54, 0.6);
    animation: pulse-red 0.5s infinite;
}

.status-indicator.error::before {
    border-color: rgba(244, 67, 54, 0.3);
    animation: ripple-red 0.5s infinite;
}

.status-indicator.failed {
    background: #9c27b0;
    box-shadow: 0 0 12px rgba(156, 39, 176, 0.6);
    animation: pulse-purple 1.2s infinite;
}

.status-indicator.failed::before {
    border-color: rgba(156, 39, 176, 0.3);
    animation: ripple-purple 1.2s infinite;
}

.status-text {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
}

/* 脉冲动画 */
@keyframes pulse-green {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes pulse-orange {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.7;
    }
}

@keyframes pulse-red {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.6;
    }
}

@keyframes pulse-purple {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.12);
        opacity: 0.75;
    }
}

/* 涟漪动画 */
@keyframes ripple-green {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

@keyframes ripple-orange {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

@keyframes ripple-red {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

@keyframes ripple-purple {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* 状态指示器的特殊效果 */


.websocket-status.connecting {
    border-color: rgba(255, 152, 0, 0.5);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(255, 152, 0, 0.2));
}

.websocket-status.disconnected {
    border-color: rgba(244, 67, 54, 0.5);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(244, 67, 54, 0.2));
}

.websocket-status.error {
    border-color: rgba(244, 67, 54, 0.5);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(244, 67, 54, 0.2));
}

.websocket-status.failed {
    border-color: rgba(156, 39, 176, 0.5);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(156, 39, 176, 0.2));
}

/* 移动端优化 */
@media (max-width: 768px) {
    .websocket-status {
        padding: 6px 10px;
        font-size: 12px;
        gap: 8px;
    }
    
    .status-indicator {
        width: 10px;
        height: 10px;
    }
    
    .status-indicator::before {
        width: 16px;
        height: 16px;
    }
}

/* 交易表单连接提示 */
.connection-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
    font-size: 14px;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 8px;
}

.connection-notice i {
    font-style: normal;
    font-size: 16px;
}

/* 投注按钮禁用状态 */
#buy-btn:disabled {
    background: #6c757d !important;
    color: #fff !important;
    cursor: not-allowed !important;
    opacity: 0.7;
}

#buy-btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* 金额输入框禁用状态 */
#amount:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .connection-indicator {
        top: 8px;
        right: 15px;
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .connection-indicator .status-dot {
        width: 6px;
        height: 6px;
    }
}

/* 密码强度指示器（可选功能） */
.password-strength {
    margin-top: 5px;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    transition: width 0.3s, background-color 0.3s;
}

.password-strength-weak {
    background: #dc3545;
    width: 33%;
}

.password-strength-medium {
    background: #ffc107;
    width: 66%;
}

.password-strength-strong {
    background: #28a745;
    width: 100%;
}

/* K线图弹窗样式 */
.kline-modal-content {
    width: 95%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.kline-header {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
}

.kline-modal-body {
    padding: 0;
    max-height: 80vh;
    overflow-y: auto;
}

/* 轮次选择区域 */
.round-selector {
    padding: 20px;
}

.selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.selector-header h4 {
    margin: 0;
    color: #333;
    font-size: 16px;
}

.refresh-rounds-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.refresh-rounds-btn:hover {
    background: #e9ecef;
}

.rounds-list {
    max-height: 400px;
    overflow-y: auto;
}

.round-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.round-item:hover {
    background: #f8f9fa;
    border-color: #ff9800;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.15);
}

.round-item.completed {
    border-left: 4px solid #4caf50;
}

.round-item.active {
    border-left: 4px solid #2196f3;
}

.round-info {
    flex: 1;
}

.round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.round-number {
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

.round-status {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}

.round-status.completed {
    background: #e8f5e8;
    color: #4caf50;
}

.round-status.active {
    background: #e3f2fd;
    color: #2196f3;
}

.round-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.time-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.start-time {
    color: #666;
    font-size: 12px;
}

.duration {
    color: #999;
    font-size: 11px;
}

.price-info {
    text-align: right;
}

.settlement-price {
    font-weight: bold;
    font-size: 14px;
}

.settlement-price.positive {
    color: #4caf50;
}

.settlement-price.negative {
    color: #f44336;
}

.no-price {
    color: #999;
    font-size: 12px;
}

.round-arrow {
    color: #999;
    font-size: 18px;
    margin-left: 10px;
}

/* K线图显示区域 */
.kline-display {
    padding: 20px;
}

.round-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.round-info-header h4 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.back-to-list-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.back-to-list-btn:hover {
    background: #5a6268;
}

/* 轮次摘要 */
.round-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-item .label {
    color: #666;
    font-size: 13px;
}

.summary-item .value {
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

/* K线图表容器 */
.kline-chart-container {
    height: 300px;
    margin-bottom: 20px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
}

/* 交易统计 */
.trading-stats {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
}

.trading-stats h5 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 14px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: white;
    border-radius: 8px;
}

.stat-label {
    color: #666;
    font-size: 12px;
}

.stat-value {
    font-weight: bold;
    color: #333;
    font-size: 13px;
}

/* 加载和错误状态 */
.loading-text, .error-text, .empty-text {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
}

.error-text {
    color: #f44336;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .kline-modal-content {
        width: 98%;
        margin: 10px auto;
    }
    
    .round-summary {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .round-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .price-info {
        text-align: left;
    }
}

/* 图表类型切换按钮 */
.chart-type-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.chart-type-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chart-type-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.chart-type-btn:hover:not(.active) {
    background: #f8f9fa;
    border-color: #007bff;
}

/* 图表区域内容 */
.chart-section-content {
    margin-top: 15px;
}

/* 每日K线图信息 */
.daily-kline-info {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.daily-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.daily-summary .summary-item {
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.daily-summary .summary-item .label {
    display: block;
    color: #666;
    font-size: 12px;
    margin-bottom: 5px;
}

.daily-summary .summary-item .value {
    display: block;
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

/* 每日K线图画布 */
#dailyKlineChart {
    width: 100% !important;
    height: 300px !important;
    margin-bottom: 15px;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .chart-type-toggle {
        flex-direction: column;
        gap: 8px;
    }
    
    .chart-type-btn {
        text-align: center;
        padding: 10px;
    }
    
    .daily-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .daily-summary .summary-item .value {
        font-size: 14px;
    }
}